#!/bin/bash
# USAGE:
#	. initialize
#
# DESCRIPTION:
#  INITIALIZE is an internal ADORE command.  
#  It is used to load and check user settings. Regular users will probably not
#  need to use it. For saving and loading user settings see "? settings" 
#
# INPUT:
#  No input parameters are required.
#
# OUTPUT:
#  Output's user settings file path.
#  
if [ -e "${u}" ]; then
  if [ -r "${u}" ]; then
    u=`canonicalPath ${u}`
    echo "User Settings File: ${u}"
    source ${u} 					#load user project settings
  else
    echo "Can not read user settings file: ${u}"
  fi
else
  echo "User settings file is not defined. Using defaults."
fi
eval ${d}				#overwrite user settings with commandline
if [ -z "${ADOREFOLDER}" ]; then
 [ -z ${ADORESCR} ] && ADORESCR=`dirname ${0}`
 ADOREFOLDER=${ADORESCR//\/scr/} # Remove the scripts folder. 
fi
source "${ADOREFOLDER}/set/default.set" 	#use defaults to fill in the rest.
source "${ADOREFOLDER}/scr/fun/tabcompletion"   #add tabcompletion
#Check settings and make suggestions
checkInitialSettings

# check if the values are set or not. If empty set to "dummy"
[ -z "${m_in_dat}" 		] && m_in_dat="dummy"
[ -z "${m_in_vol}" 		] && m_in_vol="dummy"
[ -z "${m_in_lea}" 		] && m_in_lea="dummy"
[ -z "${m_in_null}" 		] && m_in_null="dummy"
# check if the values are set or not. If empty set to "dummy"
[ -z "${s_in_dat}" 		] && s_in_dat="dummy"
[ -z "${s_in_vol}" 		] && s_in_vol="dummy"
[ -z "${s_in_lea}" 		] && s_in_lea="dummy"
[ -z "${s_in_null}" 		] && s_in_null="dummy"
